package cn.xspace.module.other.activity;

import android.content.Intent;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.ListView;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.cn.wt.wtutils.utils.ToastUtils;
import com.xspace.android.xafcommon.base.BaseActivity;

import cn.xspace.app.view.TitleBar;
import cn.xspace.module.other.R;
import cn.xspace.module.other.adapter.UserFeedbackAdapter;

public class UserFeedbackAct extends BaseActivity implements View.OnClickListener {
    public TitleBar mSettingTitleBar;
    public RelativeLayout mFeedbackSearch;
    public ImageView mFbArrow;
    public LinearLayout mFeedbackAll;
    public ListView mFeedbackListView;
    public TextView mFeedbackAllQues;
    public TextView mFeedbackServices;
    public LinearLayout mActivityUserFeedback;

    @Override
    protected void initView() {
        setContentView(R.layout.activity_user_feedback);
    }


    @Override
    protected void initData() {

    }

    @Override
    protected void initFindViewById() {
        mSettingTitleBar = (TitleBar) findViewById(R.id.setting_title_bar);
        mFeedbackSearch = (RelativeLayout) findViewById(R.id.feedback_search);
        mFbArrow = (ImageView) findViewById(R.id.fb_arrow);
        mFeedbackAll = (LinearLayout) findViewById(R.id.feedback_all);
        mFeedbackListView = (ListView) findViewById(R.id.feedback_listView);
        mFeedbackAllQues = (TextView) findViewById(R.id.feedback_all_ques);
        mFeedbackServices = (TextView) findViewById(R.id.feedback_services);
        mActivityUserFeedback = (LinearLayout) findViewById(R.id.activity_user_feedback);
    }

    @Override
    protected void initEvent() {
        mFeedbackListView.setItemsCanFocus(true);
        UserFeedbackAdapter adapter = new UserFeedbackAdapter(this);
        mFeedbackListView.setAdapter(adapter);

        mSettingTitleBar.setLeftLayoutClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                finish();
            }
        });
        mFeedbackSearch.setOnClickListener(this);
        mFeedbackAllQues.setOnClickListener(this);
        mFeedbackServices.setOnClickListener(this);
        mFeedbackAll.setOnClickListener(this);
    }

    @Override
    public void onClick(View v) {
        if (v.getId() == R.id.feedback_search) {  //搜索框
            startActivity(new Intent(this, SearchAct.class));
        } else if (v.getId() == R.id.feedback_all_ques) { //全部问题
            startActivity(new Intent(this, AllQuestionAct.class));
        } else if (v.getId() == R.id.feedback_services) { //提问客服
            ToastUtils.show(this, "打开客服界面");
        } else if (v.getId() == R.id.feedback_all) { //常见 - 全部问题
            ToastUtils.show(this, "点击常见问题 - 全部问题");
            startActivity(new Intent(this, AllQuestionAct.class));
        }
    }
}
